package com.netdisk.mapper;

import com.netdisk.dto.response.file.ShareDTO;
import com.netdisk.entity.File;
import com.netdisk.entity.Share;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShareMapper {
    void insert(Share file);

    /*根据shareId查询分享*/
    @Select("select * from shares where share_id = #{shareId};")
    Share findByShareId(String shareId);


    @Select("select COUNT(*) from shares where user_id = #{userId}")
    Integer getShareCountById(Integer userId);

    @Select("select * from shares where user_id = #{userId} limit 0,10;")
    List<Share> getShareListById(Integer userId);

    void delete(Share share);
}
